import requests

# # url = 'https://www.baidu.com/s?wd=python'
# url ='https://pic4.zhimg.com/v2-8f51c35f5e8e48d3c8616a4353178689_1440w.jpg'
# # # 请求头
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36'
}
#
# #使用脚本模拟浏览器向服务器发送请求
# response = requests.get(url,headers =headers)
# # print(response.text)
# # response.text  就是请求回来的html 代码
# #二进制的格式的返回内容，要用response.content去接收
#
# # response.json()  针对返回内容是json格式的就可以用这个方法接收
# print (response.content)
# with open('py.jpg',mode='wb') as f:
#     f.write(response.content)
url = 'http://httpbin.org/post'
params= {
    'name':'admin',
    'password':'123456'
}
res = requests.post(url,headers = headers,data=params)
print (res.text)
print (res.url)